package com.gj;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;

import java.util.concurrent.CountDownLatch;

@EnableEurekaClient
@EnableFeignClients
@SpringBootApplication
public class TransactionTaskApplication {

    private static final Logger logger = LoggerFactory.getLogger(TransactionTaskApplication.class);

    public static void main(String[] args) {
        SpringApplication application = new SpringApplication(TransactionTaskApplication.class);
        ConfigurableApplicationContext context = application.run(args);
        try {
            ProcessMessageTask task = context.getBean(ProcessMessageTask.class);
            task.start();
            new CountDownLatch(1).await();
        }catch (Exception e){
            logger.error("消息发送服务启动异常");
        }
    }

}
